<template>
	<view class="mine-container" :style="{height: `${windowHeight}px`}">
		<!--顶部个人信息栏-->
		<view class="header-section">
			<view class="flex padding ">
				<view class="flex align-center">
					<!-- <view v-if="!avatar" class="cu-avatar xl round bg-white">
						<view class="iconfont icon-people text-gray icon"></view>
					</view> -->
					<view @click="handleToLogin" class="login-tip">
						社会化用车
					</view>
				</view>
				<!-- <view @click="handleToInfo" class="flex align-center">
					<view class="iconfont icon-people  icon" @click="handleQRCode"></view>
					<view class="iconfont icon-right"></view>
				</view> -->
			</view>
		</view>
			<view class="menu-list">
				<view class="list-cell list-cell-arrow" @click="handleToUnit">
					<view class="menu-item-box">
						<view class="iconfont menu-icon">
							<image class="menu-item-box-image" src="../../static/images/use/unit.png"></image>
						</view>
						<view>单位信息</view>
					</view>
				</view>
				<view class="list-cell list-cell-arrow" @click="handleCar">
					<view class="menu-item-box">
						 <view class="iconfont menu-icon">
						 	<image class="menu-item-box-image" src="../../static/images/use/car.png"></image>
						 </view>
						<view>车辆信息</view>
					</view>
				</view>
				<view class="list-cell list-cell-arrow" @click="handleDriver">
					<view class="menu-item-box">
						<view class="iconfont menu-icon">
							<image class="menu-item-box-image" src="../../static/images/use/driver.png"></image>
						</view>
						<view>驾驶员信息</view>
					</view>
				</view>
				<view class="list-cell list-cell-arrow" @click="handleFee">
					<view class="menu-item-box">
						<view class="iconfont menu-icon">
							<image class="menu-item-box-image" src="../../static/images/use/fee.png"></image>
						</view>
						<view>费用标准</view>
					</view>
				</view>
			</view>
			<view class="menu-list">
				<view class="list-cell list-cell-arrow" @click="handleApply">
					<view class="menu-item-box">
						<view class="iconfont menu-icon">
							<image class="menu-item-box-image" src="../../static/images/use/apply.png"></image>
						</view>
						<view>用车申请记录</view>
					</view>
				</view>
				<view class="list-cell list-cell-arrow" @click="handleRecord">
					<view class="menu-item-box">
						<view class="iconfont menu-icon">
							<image class="menu-item-box-image" src="../../static/images/use/record.png"></image>
						</view>
						<view>录入补单信息</view>
					</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import storage from '@/utils/storage'
	import store from '@/store'
	import {
		ref
	} from "vue";
	import config from '@/config.js'
	const name = store.state.user.name;
	const version = config.appInfo.version;
	const avatar = ref(store.state.user.avatar);
	const windowHeight = ref(uni.getSystemInfoSync().windowHeight - 50);
	const popup = ref(null);

	uni.$on('refresh', () => {
		avatar.value = store.state.user.avatar;
	})

	function handleToInfo() {
		uni.navigateTo({
			url: '/pages/mine/info/index'
		});
	};
// 单位信息
	function handleToUnit() {
		uni.navigateTo({
			url: '/pages/use/unit/index'
		});
	};
// 车辆信息
	function handleCar() {
		uni.navigateTo({
			url: '/pages/use/car/index'
		});
	};
	// 驾驶员信息
	function handleDriver() {
	
		uni.navigateTo({
			url: '/pages/use/driver/index'
		});
	};
// 费用标准
	function handleFee() {
		uni.navigateTo({
			url: '/pages/use/fee/index'
		});
	};
// 用车申请记录
	function handleApply() {
		uni.navigateTo({
			url: '/pages/use/apply/index'
		});
	};
	// 录入补单信息
	function handleRecord(){
		uni.navigateTo({
			url: '/pages/use/recording/index'
		});
	}

	function handleLogout() {
		popup.value.open();
	};

	function dialogConfirm() {
		//console.log('----------------点击确认------------')
		store.dispatch('LogOut').then(() => {
			uni.reLaunch({
				url: '/pages/login'
			});
		})
	};

	function dialogClose() {
		//console.log('点击关闭')
	};

	function handleHelp() {
		uni.navigateTo({
			url: '/pages/mine/help/index'
		});
	};

	function handleAbout() {
		uni.navigateTo({
			url: '/pages/mine/about/index'
		});
	};

	function handleJiaoLiuQun() {
		uni.showToast({
			title: 'QQ群：133713780',
			mask: false,
			icon: "none",
			duration: 1000
		});
	};

	function handleBuilding() {
		uni.showToast({
			title: '模块建设中~',
			mask: false,
			icon: "none",
			duration: 1000
		});
	}
	
	function handleQRCode(){
		
	}
</script>

<style lang="scss">
	page {
		background-color: #f5f6f7;
	}
	.menu-item-box-image{
		width: 24px;
		height: 24px;
		margin-right: 10px;
	}
	.mine-container {
		width: 100%;
		height: 100%;
		.header-section {
			padding: 15px 15px 45px 15px;
			background-color: #3c96f3;
			color: white;
			height:80px;
			.login-tip {
				font-size: 18px;
				margin-left: 10px;
			}

			.cu-avatar {
				border: 2px solid #eaeaea;

				.icon {
					font-size: 40px;
				}
			}

			.user-info {
				margin-left: 15px;

				.u_title {
					font-size: 18px;
					line-height: 30px;
				}
			}
		}

		.content-section {
			position: relative;
			top: -50px;

			.mine-actions {
				margin: 15px 15px;
				padding: 20px 0px;
				border-radius: 8px;
				background-color: white;

				.action-item {
					.icon {
						font-size: 28px;
					}

					.text {
						display: block;
						font-size: 13px;
						margin: 8px 0px;
					}
				}
			}
		}
	}
</style>